﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace miniCCR
{

    public class iTask
    {
        public iTask(Operation sendOP, Operation waitOP)
        {
            _SendOP = sendOP;
            _WaitOP = waitOP;

        }

        public void Run()
        {

        }

        public bool IsComplete()
        {
            return true;
        }

        private Operation _SendOP = null;

        private Operation _WaitOP = null;

        public Transfer _Transfer = new Transfer();

        internal bool Do()
        {
            _Transfer.Send(_SendOP);

            if (_WaitOP != null)
                return false;

            return true;

        }

        public bool TrySetWaitOP(Operation op)
        {
            if( _WaitOP._WaitCode == op._WaitCode)
            {
                _WaitOP = op;
                return true;
            }
            
            return false;
        }
    }
}
